<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta http-equiv="x-ua-compatible" content="ie=7" />
        <title><?php echo ($title); ?></title>
        <link href="<?php echo C('WEB_URL');?>Public/admin/style/base.css" rel="stylesheet" type="text/css" />
        <link href="<?php echo C('WEB_URL');?>Public/admin/style/master.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="<?php echo C('WEB_URL');?>Public/admin/js/jquery1.9.1.js"></script>
        <script type="text/javascript" src="<?php echo C('WEB_URL');?>Public/admin/js/base.js"></script>
        <script type="text/javascript" src="<?php echo C('WEB_URL');?>Public/admin/My97/WdatePicker.js"></script>
        
        
      
    <script>
        function del(id){
            if(confirm('确定要删除记录吗?')){
                var url="__URL__/del/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                        $(".list > tbody").children("#J_list"+data['data']).remove();
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        function accept(id){
            if(confirm('确定要通过记录吗?')){
                var url="__URL__/accept/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        
        function reject(id){
            if(confirm('确定要拒接记录吗?')){
                var url="__URL__/reject/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        
        
        function used(id){
            if(confirm('确定要启用记录吗?')){
                var url="__URL__/used/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    	
                    }else{
                        alert(data['info']);
                    }
                    
                    location.reload() ;
                })
            }
        }
        
        function unused(id){
            if(confirm('确定要禁用记录吗?')){
                var url="__URL__/unused/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                       // $(".list > tbody").children("#J_list"+data['data']).remove();
                        alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                    location.reload() ;
                })
            }
        }
        
        
    </script>
    
    </head>
    <body>
        <div id="wrapper">
            <h2><?php echo ($title); ?>卡券<a href="<?php echo U('index', array('sp' =>$nowPage)) ;?>">返回</a></h2>
            <form action="<?php echo U('save') ;?>" method="post" enctype="multipart/form-data" id="myform">
    
            
                <table class="form" >
                
                        
            <input type="hidden" name ='sp'  value=<?php echo $nowPage ?></input>
            
                     <tr>
                        <td class="tkey">所属商家:</td>
                        <td>
                        
                        <?php echo ($data['business_name']); ?>
                        
							             <!--<select name='business_id' style="width:150px;">
							
                <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option <?php if($data['business_id']==$data['business_id']){echo 'selected';} ?> value="<?php echo ($data['business_id']); ?>"><?php echo ($data['business_name']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
							</select> -->
						</td>
                    </tr>
                    <tr>
                        <td class="tkey">卡券名称:</td>
                        <td><input type="text" name="coupon_name" value="<?php echo ($data['coupon_name']); ?>" class="inputText" style='width:400px;' /></td>
                    </tr>
                    <tr>
                        <td class="tkey">原价:</td>
                        <td><input type="text" name="old_price" value="<?php echo ($data['old_price']); ?>" class="inputText" /></td>
                    </tr>
                    <tr>
                        <td class="tkey">折扣价:</td>
                        <td><input type="text" name="new_price" value="<?php echo ($data['new_price']); ?>" class="inputText" /></td>
                    </tr>
                    <tr>
                        <td class="tkey w160">卡券小图:</td>
						<td>
							<?php if($data['small_logo']){ ?>
							<img src="<?php echo C('WEB_URL'); echo ($data['small_logo']); ?>" style="width:50px">
							<?php }else{ ?>
							请上传图片
							<?php } ?>
							<input type="file" name="file1"  />
						</td>
                    </tr>
                    <tr>
                        <td class="tkey w160">卡券大图:</td>
						<td>
							<?php if($data['big_logo']){ ?>
							<img src="<?php echo C('WEB_URL'); echo ($data['big_logo']); ?>" style="width:50px">
							<?php }else{ ?>
							请上传图片
							<?php } ?>
							<input type="file" name="file2"  />
						</td>
                    </tr>
					<tr>
                        <td class="tkey">开始日期:</td>
                        <td><input type="text" name="start_use_time" value="<?php echo ($data['start_use_time']); ?>" class="inputText" /></td>
                    </tr>
                      <tr>
                        <td class="tkey">结束日期:</td>
                        <td><input type="text" name="end_use_time" value="<?php echo ($data['end_use_time']); ?>" class="inputText" /></td>
                    </tr>
					<tr>
                        <td class="tkey">温馨提示:</td>
                        <td><textarea name="tishi" style="width:180px;height:100px;"><?php echo ($data['tishi']); ?></textarea></td>
                    </tr>
                    <tr>
                        <td class="tkey">规则提醒:</td>
                        <td><textarea name="des" style="width:180px;height:100px;"><?php echo ($data['des']); ?></textarea></td>
                    </tr>
                    <tr>
                        <td class="tkey">&nbsp;</td>
						<input type="hidden" name ='coupon_id' value="<?php echo ($data['coupon_id']); ?>">
						
 <td >
						
						  <?php if($data['status']==1){ ?>

                                 
                                 <span class="btnGreen" onClick="accept(<?php echo ($data['coupon_id']); ?>)">通过</span>
                                 
                                 <span class="btnGray" onClick="reject(<?php echo ($data['coupon_id']); ?>)">不通过</span>
                                 
                                 
                                 
                                 <?php  }?>
                           
                    
                                 <?php if($data['status']==2){ ?>

                                 
                                 <span class="btnGray" onClick="unused(<?php echo ($data['coupon_id']); ?>)">禁用</span>
                           
                                 
                                 <?php  }?>
                           
                     
                     
                             <?php if($data['status']==3){ ?>

                                 已驳回
                                 
                           <?php  }?>
                           
                           
                                       <?php if($data['status']==4){ ?>

                                 
                                 <span class="btnGreen" onClick="used(<?php echo ($data['coupon_id']); ?>)">启用</span>
                           
                                 
                                 <?php  }?>
                                 
						
</td>
             <!--            <td><input type="submit" value="确定" class="btnOrange" /></td> -->
                    </tr>
                </table>
            </form>
        </div>
       
        <style>
            .picList li{float:left;margin:0 10px;}
            .picList li a{display:block;text-align:center;color:#f60}
        </style>
</body>
</html>